$(document).ready(function() {
	outerLayout = $('body').layout({ 
			center__paneSelector:	".outer-center" 
		,	west__paneSelector:		".outer-west"
		 
		//,	east__paneSelector:		".outer-east" 
		,	west__size:				230 
		//,	east__size:				125 
		,	spacing_open:			8 // ALL panes
		,	spacing_closed:			8 // ALL panes
		,	north__spacing_open:	0
		,	south__spacing_open:	0
		,	center__onresize:		"middleLayout.resizeAll" 
		}); 
	$("#browser").treeview({
		animated : "fast",
		collapsed : true,
		unique: true,
		//persist : "cookie",
		persist: "location"
		//toggle: function() {
		//	alert("dave");
		//window.console && console.log("%o was toggled", this);
		//}
	});
	$("#accordion").accordion({ 
		header: "h3",
		autoHeight: false,
		navigation: true
		});
	$('#menuArbolG').show();
	$('#content').show();
	$(document).ajaxStart(function() {
		//console.log("ajax start");
	});
	$(document).ajaxStop(function() {
		//console.log("ajax end");
	});

	$('#tbl_result tbody tr').hover(function() {
		$(this).addClass('ui-state-hover');
	}, function() {
		$(this).removeClass('ui-state-hover');
	});
	Grider = {
		defaults : {
			initCalc : true,
			addRow : false,
			addRowWithTab : true,
			delRow : true,
			decimals : 2,
			addRowText : '<caption><a href="#">Add Row</a></caption>',
			addRowText : '<td><a href="#"" class="ui-button-text delete">'
							+'<span class="ui-widget ui-icon ui-icon-trash"></span>'
							//+'<span style="color: #6EAC2C;">dave</span>'
							+'<span style="color: #FFFFFF;">.</span>'
							+'</a></td>',
			//delRowText : '<td><a href="#" class="delete">delete</a></td>',
			delRowText : '<td><a href="#"" class="ui-button-text delete">'
							+'<span class="ui-widget ui-icon ui-icon-trash"></span>'
							//+'<span style="color: #6EAC2C;">dave</span>'
							+'<span style="color: #FFFFFF;">.</span>'
							+'</a></td>',
			countRow : false,
			countRowCol : 0,
			countRowText : 'Item',
			countRowAdd : true,
			addedRow : true
		}
	}
});
Function.prototype.defaults = function() {
	var _f = this;
	var _a = Array(_f.length - arguments.length).concat(Array.prototype.slice.apply(arguments));
	return function() {
		return _f.apply(_f, Array.prototype.slice.apply(arguments).concat(_a.slice(arguments.length, _a.length)));
	}
}
VentanaPopUp = function(pheight, pwidth, pmodal, ptitle, purl, pbuttons, presizable, pzindex,pcontent,pcallback) {
	
	$('<div>').dialog({
		//autoOpen: false,
		height : pheight,
		resizable : presizable,
		width : pwidth,
		modal : pmodal,
		zIndex : pzindex,
		//height: 'auto',
		//hide: { effect: 'drop', direction: "down" } ,
		//hide: 'slide' ,
		hide : 'scale',
		show : {
			effect : 'drop',
			direction : "up"
		},
		title : ptitle,
		create: function(event, ui) {
			if (pcontent !='')
				$(this).html('<table align="center" style="width: 100%; height: 100%; padding: 0px; margin: 0px;" cellspacing="0" cellpadding="0"><tr><td ><div align="center">'+pcontent+'</div></td></tr></table>');
							
		},
		open : function() {
			if (purl !='')
				$(this).load(jQuery.scriptPath + 'index.php/' + purl);
		},
		close : function() {
			$(this).remove();
		},
		buttons : pbuttons
	});
}.defaults(250, 250, true, 'Sigi Web', '', {}, false, 99,'',null);
function Logout() {
	$.ajax({
		dataType : "html",
		type : "POST",
		url : jQuery.scriptPath + 'index.php/Index/logout/',
		data : '',
		success : function(requestData) {
			document.location.href = jQuery.scriptPath;
		},
		error : function(requestData, strError, strTipoError) {
			alert("Error " + strTipoError + ": " + strError);
		}
	});
}